﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TemplateWeb.Helpers
{
    public class StringHelper
    {
        public static string Truncate(string input, int length)
        {
            if (input.Length > length)
            {
                input = input.Substring(0, length);
            }

            int lastPos = input.LastIndexOf(" ");
            if (lastPos == -1)
                return string.Empty;
            return input.Substring(0, lastPos);
        }
    }
}